# 重置密码API
import requests

import config


class ResetPassword:
    def __init__(self):
        self.identify_username_url = config.BASE_URL + "/api/user/rest/get-by-username"  # 确认账号url
        self.get_email_code_url = config.BASE_URL + "/api/user/rest/get-email-code"  # 获取邮箱验证码url
        self.verify_bond_email_url = config.BASE_URL + "/api/user/rest/verify-email-code"  # 核实绑定的邮箱url
        self.reset_password_url = config.BASE_URL = config.BASE_URL + "/api/user/rest/pwd"  # 重置密码url

    # 确认账号
    def identify_username(self, data):
        return requests.get(url=self.identify_username_url, params=data)

    # 获取邮箱验证码
    def get_email_code(self, data):
        return requests.get(url=self.get_email_code_url, params=data)

    # 核实绑定的邮箱
    def verify_bond_email(self, data):
        return requests.post(url=self.verify_bond_email_url, json=data)

    # 重置密码
    def reset_password(self, data):
        return requests.post(self.reset_password_url, json=data)

